<?php

namespace App\Http\Controllers;

use App\Jobs\UpdateUserBalance;
use Illuminate\Http\Request;

class JobsController extends Controller
{
    public function index()
    {
        /*$amount = $request->input('amount');
        dump($amount);
        // 分发队列任务
        UpdateUserBalance::dispatch($userId, $amount);

        return response()->json(['status' => 'Balance update dispatched']);*/
        #  echo   $csrfToken = session()->token();

    }

    public function updateBalance(Request $request, $userId)
    {


        $amount = $request->input('amount');

        // 分发队列任务
        UpdateUserBalance::dispatch($userId, $amount);

        return response()->json(['status' => 'Balance update dispatched']);
    }



}
